using System;
using System.Text;
using System.Collections.Generic;
using System.Data;
using System.Data.Common;
using OVS.BusinessObjects;
using OVS.DAL;

namespace OVS.BLL
{
	public partial class ScheduleBLL
	{
		private ScheduleDAO _ScheduleDAO;

		public ScheduleDAO ScheduleDAO
		{
			get { return _ScheduleDAO; }
			set { _ScheduleDAO = value; }
		}

		public ScheduleBLL()
		{
			ScheduleDAO = new ScheduleDAO();
		}
		public List<Schedule> GetSchedules()
		{
			try
			{
				return ScheduleDAO.GetSchedules();
			}
			catch(Exception ex)
			{
				throw ex;
			}
		}
		public Schedule GetSchedule(int sche_id)
		{
			try
			{
				return ScheduleDAO.GetSchedule(sche_id);
			}
			catch(Exception ex)
			{
				throw ex;
			}
		}
		public int AddSchedule(Schedule oSchedule)
		{
			try
			{
				return ScheduleDAO.AddSchedule(oSchedule);
			}
			catch (Exception ex)
			{
				throw ex;
			}
		}
		public int UpdateSchedule(Schedule oSchedule)
		{
			try
			{
				return ScheduleDAO.UpdateSchedule(oSchedule);
			}
			catch (Exception ex)
			{
				throw ex;
			}
		}
		public int RemoveSchedule(Schedule oSchedule)
		{
			try
			{
				return ScheduleDAO.RemoveSchedule(oSchedule);
			}
			catch (Exception ex)
			{
				throw ex;
			}
		}
		public int RemoveSchedule(int sche_id)
		{
			try
			{
				return ScheduleDAO.RemoveSchedule(sche_id);
			}
			catch (Exception ex)
			{
				throw ex;
			}
		}
		public List<Schedule> GetSchedulesOfUser(int user_id)
		{
			try
			{
				return ScheduleDAO.GetSchedulesOfUser(user_id);
			}
			catch (Exception ex)
			{
				throw ex;
			}
		}
		public User GetUserOfSchedule(int user_id)
		{
			try
			{
				return ScheduleDAO.GetUserOfSchedule(user_id);
			}
			catch (Exception ex)
			{
				throw ex;
			}
		}
		public User GetUserOfSchedule(Schedule oSchedule)
		{
			try
			{
				return ScheduleDAO.GetUserOfSchedule(oSchedule.user_id);
			}
			catch (Exception ex)
			{
				throw ex;
			}
		}
		public List<Schedule> DeserializeSchedules(string Path)
		{
			try
			{
				return GenericXmlSerializer<List<Schedule>>.Deserialize(Path);
			}
			catch (Exception ex)
			{
				throw ex;
			}
		}
		public void SerializeSchedules(string Path, List<Schedule> Schedules)
		{
			try
			{
				GenericXmlSerializer<List<Schedule>>.Serialize(Schedules, Path);
			}
			catch (Exception ex)
			{
				throw ex;
			}
		}
	}
}
